/** 
  查看
*/
<template>
  <div class="select-score-container">
    <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-tab-pane :label="$t('scoreEntryMana.scoreList') + '（' + copyDetailInfo.numOfPeople + '）' + $t('scoreEntryMana.people')" name="first">
        <el-card shadow="never" v-loading="loading" body-style="padding: 24px;">
          <el-row style="padding: 15px 0 7px 0;">
            <!-- 课程代码 -->
            <el-col :span="8">
              {{ $t('scoreEntryMana.courseCode') }}：{{ copyDetailInfo.courseCode }}
            </el-col>
            <!-- 课程名称 -->
            <el-col :span="8">
              {{ $t('scoreEntryMana.courseName') }}：{{ copyDetailInfo.courseName }}
            </el-col>
            <!-- 课程序号 -->
            <el-col :span="8">
              {{ $t('scoreEntryMana.courseNum') }}：{{ copyDetailInfo.courseNum }}
            </el-col>
          </el-row>
          <el-row style="margin: 15px 0;">
            <el-col :span="24">
              <el-table border :data="dataList" size="mini">
                <!-- 序号 -->
                <el-table-column :label="$t('scoreEntryMana.serialNumber')" type="index" align="center" width="80"></el-table-column>
                <!-- 学号 -->
                <edu-table-column :label="$t('scoreMangementBase.studentId')" prop="studentId" align="center"></edu-table-column>
                <!-- 姓名 -->
                <edu-table-column :label="$t('scoreMangementBase.studentName')" prop="studentName" align="center"></edu-table-column>
                <!-- 修课类别 -->
                <edu-table-column :label="$t('scoreEntryMana.courseCategory')" prop="learnTypeName" align="center"></edu-table-column>
                <!-- 平时1成绩 -->
                <edu-table-column :label="$t('scoreEntryMana.usuallyOneGrade')" prop="dailyScore" align="center"></edu-table-column>
                <!-- 期中成绩 -->
                <edu-table-column :label="$t('scoreEntryMana.midTermGrades')" prop="midtermScore" align="center"></edu-table-column>
                <!-- 期末成绩 -->
                <edu-table-column :label="$t('scoreEntryMana.finalGrade')" prop="finalScore" align="center"></edu-table-column>
                <!-- 总评成绩 -->
                <template v-if="basicInfo.examType === '2'">
                  <!-- 总评成绩 -->
                  <edu-table-column :label="$t('scoreEntryMana.overallRating')" prop="totalMarkScore" align="center"></edu-table-column>
                </template>
                <!-- 重缓考 -->
                <template v-if="basicInfo.examType === '1'">
                  <!-- 重考成绩 -->
                  <edu-table-column :label="$t('redelayTestScoreMana.retakeScore')" prop="retakeScore" align="center"></edu-table-column>
                  <!-- 缓考成绩 -->
                  <edu-table-column :label="$t('redelayTestScoreMana.postponement')" prop="postponement" align="center"></edu-table-column>
                </template>
                <!-- 最终成绩 -->
                <edu-table-column :label="$t('scoreEntryMana.overallRating')" prop="lastScore" align="center"></edu-table-column>
                <!-- 绩点 -->
                <edu-table-column :label="$t('gradeRelatedSetting.gradePoint')" prop="gradePoint" align="center"></edu-table-column>
                <!-- 通过 -->
                <edu-table-column :label="$t('scoreMangementBase.pass')" prop="isPass" align="center">
                  <template slot-scope="scope">
                    <span :style="!scope.row.isPass ? 'color: red;' : ''">{{ !scope.row.isPass ? $t('scoreMangementBase.no') : $t('scoreMangementBase.yes') }}</span>
                  </template>
                </edu-table-column>
                <!-- 状态 -->
                <edu-table-column :label="$t('scoreMangementBase.pass')" prop="releaseType" align="center">
                  <template slot-scope="scope">{{ scope.row.releaseType === '1' ? $t('scoreEntryMana.alreadyPublish') : $t('scoreEntryMana.notPublish') }}</template>
                </edu-table-column>
              </el-table>
              <el-row type="flex" class="row-bg" justify="end" style="margin-top: 15px;">
                <el-col>
                  <el-pagination
                    @size-change="handleSizeChange"
                    @current-change="handleCurrentChange"
                    :current-page="queryForm.pageNum_"
                    :page-sizes="[20, 40, 80, 100]"
                    :page-size="queryForm.pageSize_"
                    layout="total, sizes, prev, pager, next, jumper"
                    :total="queryForm.total_"
                    style="float:right;margin-top:10px">
                  </el-pagination>
                </el-col>
            </el-row>
            </el-col>
          </el-row>
        </el-card>
      </el-tab-pane>
      <el-tab-pane :label="$t('scoreEntryMana.scoreStatisticalDistribution')" name="second">
        <el-card shadow="never" body-style="padding: 24px;">
          <h1 class="condition-title">{{ $t('scoreEntryMana.scoreStatusInfo') }}</h1>
          <table class="table-style-baseinfos">
            <tbody>
              <tr>
                <td class="text-right-background-color">{{ $t('scoreEntryMana.courseNum') }}：</td>
                <td class="text-left-background-none">{{ basicInfo.teachingClassCode }}</td>
                <td class="text-right-background-color">{{ $t('scoreEntryMana.courseCode') }}：</td>
                <td class="text-left-background-none">{{ basicInfo.courseCode }}</td>
              </tr>
              <tr>
                <td class="text-right-background-color">{{ $t('scoreEntryMana.courseName') }}：</td>
                <td class="text-left-background-none">{{ basicInfo.courseName }}</td>
                <td class="text-right-background-color">{{ $t('scoreEntryMana.teacherName') }}：</td>
                <td class="text-left-background-none">{{ basicInfo.teacher }}</td>
              </tr>
              <tr>
                <td class="text-right-background-color">{{ $t('scoreEntryMana.assessMethod') }}：</td>
                <td class="text-left-background-none">{{ basicInfo.assessmentModeName }}</td>
                <td class="text-right-background-color">{{ $t('gradeRelatedSetting.gradeRecordMethod') }}：</td>
                <td class="text-left-background-none">{{ basicInfo.scoreRecordTypeName }}</td>
              </tr>
              <tr>
                <td class="text-right-background-color">{{ $t('scoreEntryMana.status') }}：</td>
                <td class="text-left-background-none">{{ basicInfo.releaseTypeName }}</td>
                <td class="text-right-background-color">{{ $t('scoreEntryMana.lastEntry') }}：</td>
                <td class="text-left-background-none">{{ basicInfo.lastImporterTime }}</td>
              </tr>
            </tbody>
          </table>
          <el-table class="select-score-table" border :data="basicInfo.gradeInfo" size="mini" style="width: 100%;">
            <!-- 成绩类型 -->
            <el-table-column :label="$t('scoreEntryMana.gradeType')" type="index" align="center" width="80"></el-table-column>
            <!-- 成绩记录方式 -->
            <edu-table-column :label="$t('gradeRelatedSetting.gradeRecordMethod')" prop="gradeRecordMethod" align="center"></edu-table-column>
            <!-- 百分比 -->
            <edu-table-column :label="$t('scoreEntryMana.percentage')" prop="percentage" align="center"></edu-table-column>
            <!-- 状态 -->
            <edu-table-column :label="$t('scoreEntryMana.status')" prop="status" align="center"></edu-table-column>
            <!-- 上次录入 -->
            <edu-table-column :label="$t('scoreEntryMana.lastEntry')" prop="lastEntry" align="center"></edu-table-column>
          </el-table>
        </el-card>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>
<script>
import scoreManagementApi from 'common/src/api/scoreManagement/scoreManagement';

export default {
  components: {

  },
  data () {
    return {
      activeName: 'first',
      dataList: [
        {
            "teachingClassId":"111111112465262",
            "courseCode":"010767",
            "calendarId":null,
            "lastTerm":null,
            "tableNum":null,
            "ectTableNum":null,
            "studentId":"1859113",
            "studentName":"坠访嘉",
            "dailyScore":"44",
            "midtermScore":"44",
            "finalScore":"55",
            "totalMarkScore":"51.7",
            "lastScore":"51.7",
            "retakeScore":null,
            "slowScore":null,
            "examScore1":null,
            "examScore2":null,
            "addScore":null,
            "learnType":1,
            "learnTypeName":"正常修读",
            "gradePoint":0,
            "isPass":null,
            "releaseType":0,
            "examSituation":1,
            "examType":null,
            "keepField":null,
            "isFlag":null,
            "isEnteredScore":null
        },
        {
            "teachingClassId":"111111112465262",
            "courseCode":"010767",
            "calendarId":null,
            "lastTerm":null,
            "tableNum":null,
            "ectTableNum":null,
            "studentId":"1755029",
            "studentName":"敬一翯",
            "dailyScore":"44",
            "midtermScore":"33",
            "finalScore":"66",
            "totalMarkScore":"57.2",
            "lastScore":"57.2",
            "retakeScore":null,
            "slowScore":null,
            "examScore1":null,
            "examScore2":null,
            "addScore":null,
            "learnType":1,
            "learnTypeName":"正常修读",
            "gradePoint":0,
            "isPass":null,
            "releaseType":0,
            "examSituation":1,
            "examType":null,
            "keepField":null,
            "isFlag":null,
            "isEnteredScore":null
        },
        {
            "teachingClassId":"111111112465262",
            "courseCode":"010767",
            "calendarId":null,
            "lastTerm":null,
            "tableNum":null,
            "ectTableNum":null,
            "studentId":"1754256",
            "studentName":"李博年",
            "dailyScore":"33",
            "midtermScore":"22",
            "finalScore":"55",
            "totalMarkScore":"46.2",
            "lastScore":"46.2",
            "retakeScore":null,
            "slowScore":null,
            "examScore1":null,
            "examScore2":null,
            "addScore":null,
            "learnType":1,
            "learnTypeName":"正常修读",
            "gradePoint":0,
            "isPass":null,
            "releaseType":0,
            "examSituation":1,
            "examType":null,
            "keepField":null,
            "isFlag":null,
            "isEnteredScore":null
        },
        {
            "teachingClassId":"111111112465262",
            "courseCode":"010767",
            "calendarId":null,
            "lastTerm":null,
            "tableNum":null,
            "ectTableNum":null,
            "studentId":"1753663",
            "studentName":"冶子璇",
            "dailyScore":"22",
            "midtermScore":"23",
            "finalScore":"44",
            "totalMarkScore":"37.6",
            "lastScore":"37.6",
            "retakeScore":null,
            "slowScore":null,
            "examScore1":null,
            "examScore2":null,
            "addScore":null,
            "learnType":1,
            "learnTypeName":"正常修读",
            "gradePoint":0,
            "isPass":null,
            "releaseType":0,
            "examSituation":1,
            "examType":null,
            "keepField":null,
            "isFlag":null,
            "isEnteredScore":null
        },
        {
            "teachingClassId":"111111112465262",
            "courseCode":"010767",
            "calendarId":null,
            "lastTerm":null,
            "tableNum":null,
            "ectTableNum":null,
            "studentId":"1753567",
            "studentName":"盖美如",
            "dailyScore":"11",
            "midtermScore":"33",
            "finalScore":"33",
            "totalMarkScore":"30.8",
            "lastScore":"30.8",
            "retakeScore":null,
            "slowScore":null,
            "examScore1":null,
            "examScore2":null,
            "addScore":null,
            "learnType":1,
            "learnTypeName":"正常修读",
            "gradePoint":0,
            "isPass":null,
            "releaseType":0,
            "examSituation":1,
            "examType":null,
            "keepField":null,
            "isFlag":null,
            "isEnteredScore":null
        },
        {
            "teachingClassId":"111111112465262",
            "courseCode":"010767",
            "calendarId":null,
            "lastTerm":null,
            "tableNum":null,
            "ectTableNum":null,
            "studentId":"1752256",
            "studentName":"黄政坛",
            "dailyScore":"11",
            "midtermScore":"44",
            "finalScore":"44",
            "totalMarkScore":"40.7",
            "lastScore":"40.7",
            "retakeScore":null,
            "slowScore":null,
            "examScore1":null,
            "examScore2":null,
            "addScore":null,
            "learnType":1,
            "learnTypeName":"正常修读",
            "gradePoint":0,
            "isPass":null,
            "releaseType":0,
            "examSituation":1,
            "examType":null,
            "keepField":null,
            "isFlag":null,
            "isEnteredScore":null
        },
        {
            "teachingClassId":"111111112465262",
            "courseCode":"010767",
            "calendarId":null,
            "lastTerm":null,
            "tableNum":null,
            "ectTableNum":null,
            "studentId":"1750532",
            "studentName":"米日努尔·麦麦提江",
            "dailyScore":"22",
            "midtermScore":"55",
            "finalScore":"55",
            "totalMarkScore":"51.7",
            "lastScore":"51.7",
            "retakeScore":null,
            "slowScore":null,
            "examScore1":null,
            "examScore2":null,
            "addScore":null,
            "learnType":1,
            "learnTypeName":"正常修读",
            "gradePoint":0,
            "isPass":null,
            "releaseType":0,
            "examSituation":1,
            "examType":null,
            "keepField":null,
            "isFlag":null,
            "isEnteredScore":null
        },
        {
            "teachingClassId":"111111112465262",
            "courseCode":"010767",
            "calendarId":null,
            "lastTerm":null,
            "tableNum":null,
            "ectTableNum":null,
            "studentId":"1750515",
            "studentName":"娜菲莎·乃比江",
            "dailyScore":"33",
            "midtermScore":"44",
            "finalScore":"44",
            "totalMarkScore":"42.9",
            "lastScore":"42.9",
            "retakeScore":null,
            "slowScore":null,
            "examScore1":null,
            "examScore2":null,
            "addScore":null,
            "learnType":1,
            "learnTypeName":"正常修读",
            "gradePoint":0,
            "isPass":null,
            "releaseType":0,
            "examSituation":1,
            "examType":null,
            "keepField":null,
            "isFlag":null,
            "isEnteredScore":null
        }
      ],
      queryForm: {
        pageNum_: 1,
        pageSize_: 20,
        total_: 0
      },
      basicInfo: {
        "teachingClassId":"111111112465262",
        "teachingClassCode":"01076701",
        "courseCode":"010767",
        "courseName":"公共政策分析",
        "importerCode":"12129",
        "importerName":"金宇",
        "assessmentMode":"1",
        "assessmentModeName":"考试",
        "scoreRecordType":3,
        "scoreRecordTypeName":"五级制",
        "releaseType":0,
        "releaseTypeName":"未发布",
        "lastImporter":null,
        "lastImporterName":null,
        "lastImporterTime":null,
        "calendarId":109,
        "calendarName":"2019-2020学年第2学期",
        "tableNum":null,
        "teacher":"18008张帅",
        "scoreStructureBachelor": {},
        "examType":"1",
        "isShow":null,
        "gradeInfo": [
          {
            "gradeType": "平时1",
            "gradeRecordMethod": "百分制",
            "percentage": "70",
            "status": "未发布",
            "lastEntry": "10203张雪伟  2018-12-20 12:00:00"
          },
          {
            "gradeType": "平时2",
            "gradeRecordMethod": "百分制",
            "percentage": "70",
            "status": "未发布",
            "lastEntry": "10203张雪伟  2018-12-20 12:00:00"
          },
          {
            "gradeType": "期中成绩",
            "gradeRecordMethod": "百分制",
            "percentage": "70",
            "status": "未发布",
            "lastEntry": "10203张雪伟  2018-12-20 12:00:00"
          },
          {
            "gradeType": "期末成绩",
            "gradeRecordMethod": "百分制",
            "percentage": "70",
            "status": "未发布",
            "lastEntry": "10203张雪伟  2018-12-20 12:00:00"
          },
          {
            "gradeType": "总评成绩",
            "gradeRecordMethod": "五级制",
            "percentage": "70",
            "status": "未发布",
            "lastEntry": "10203张雪伟  2018-12-20 12:00:00"
          }
        ]
      }
    }
  },
  props: {
    detailInfo: {
      type: Object,
      default: () => {}
    }
  },
  created() {

  },
  mounted() {
  },
  watch: {
    detailInfo: {
      handler(newVal) {
        if (newVal) {
          this.copyDetailInfo = JSON.parse(JSON.stringify(newVal))
          this.copyDetailInfo.numOfPeople = this.copyDetailInfo.numOfPeople ? this.copyDetailInfo.numOfPeople : 0
        }
      },
      deep: true,
      immediate: true
    }
  },
  methods: {
    // 校验特殊字符$
    checkSpecial(rule, value, callback) {
      let regEn = /[`$]/im
      if (regEn.test(value)) {
        callback(new Error(this.$t('graduateBase.specialText')))
      } else {
        callback()
      }
    },
    handleClick() {

    },
    handleSizeChange(val) {
      this.queryForm.pageSize_ = val
      this.getListData()
    },
    handleCurrentChange(val) {
      this.queryForm.pageNum_ = val
      this.getListData()
    },
    // 返回主页
    backToMain() {
      this.$emit('refresh-main-page')
    }
  }
}
</script>

<style lang="scss" scoped>
  .select-score-container ::v-deep {
    .el-tabs__header {
      margin: 0;
    }
    .el-table th {
      border-top: 0;
    }
    .select-score-table {
      border-width: 0.5px;
      border-style: solid;
      border-color: rgba(210, 212, 214, 1);
      th {
        background: #edf1f5;
      }
    } 
    .table-style-baseinfos {
      border-collapse: collapse;
      table-layout: fixed;
      word-break: break-all;
      background-color: rgba(210, 212, 214, 1);
      border-width: 0.5px;
      border-style: solid;
      border-color: rgba(210, 212, 214, 1);
      width: 100%;
      font-weight: 401;
      font-style: normal;
      font-size: 14px;
      color: #8896a7;
      margin-bottom: 20px;
    }
    .table-style-baseinfos .text-right-background-color {
      background-color: #edf1f5;
      text-align: right;
    }
    .text-left-background-none {
      text-align: left;
    }
    .table-style-baseinfos td {
      width: 25%;
      background-color: rgba(255, 255, 255, 1);
      border-width: 0.5px;
      border-style: solid;
      border-color: rgba(210, 212, 214, 1);
      font-weight: 401;
      font-style: normal;
      font-size: 14px;
      color: #2b3b4e;
      height: 32px;
      padding: 0 10px;
    }
  }
</style>